package cn.schoolwow.quickdao.test.module.business.user.transaction.commit.flow;

import cn.schoolwow.quickdao.domain.DAO;
import cn.schoolwow.quickdao.domain.transaction.Transaction;
import cn.schoolwow.quickdao.test.module.business.user.ddl.flow.column.CreateNumberColumnFlow;
import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

public class CommitCreateNumberColumnTransactionFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        DAO dao = flowContext.checkInstanceData(DAO.class);

        dao.startTransaction(transaction -> {
            flowContext.startFlow(new CreateNumberColumnFlow())
                    .putCurrentCompositeFlowInstanceData(transaction, Transaction.class)
                    .execute();
        });
    }

    @Override
    public String name() {
        return "创建工号字段事务测试用例";
    }
}
